package com.example.rocketmq.producer.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rocket")
@RequiredArgsConstructor
public class RocketController {

    private final StreamBridge streamBridge;

    @GetMapping("/sendMsg")
    public String sendMsg(String msg) {
        boolean result = streamBridge.send("producerStr-out-0", msg);

        return result ? "success" : "fail";
    }



}
